package edu.hawaii.wicket.page.scheduler;

import org.apache.wicket.ResourceReference;
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.model.Model;
import edu.hawaii.wicket.page.BasePage;
import edu.hawaii.wicket.page.ac.ACPage;
import edu.hawaii.wicket.page.aquaponics.AquaponicsPage;
import edu.hawaii.wicket.page.lighting.LightingPage;
import edu.hawaii.wicket.page.security.SecurityPage;
import edu.hawaii.wicket.page.water.WaterPage;

/**
 * Generates Scheduler Page.
 * @author Kurt Teichman
 */
public class SchedulerPage extends BasePage { 
  /** Support serialization. */
  private static final long serialVersionUID = 1L;
  private static final ResourceReference SIDE_BAR = new ResourceReference(
          SchedulerPage.class,"side-bar.png");
  private static final ResourceReference LOGO = new ResourceReference(
          SchedulerPage.class,"logo.png");
  /**
   * Generates the Scheduler Page.
   */
  public SchedulerPage() {  
  FullCalendar fc = new FullCalendar("calendar");
  final FullCalendarSettings s = fc.getSettings();

  s.setWeekends(true);
  s.setFirstDay(FullCalendarSettings.FirstDay.SUNDAY);
  s.setWeekMode(FullCalendarSettings.WeekMode.liquid);
  String url = "http://www.google.com/calendar/feeds/";
  url += "austrian__en_gb%40holiday.calendar.google.com/public/basic";
  s.addEventSource(new GoogleCalendarEventSource(url));
  s.setHeight(535);
  add(fc);
//Now add the links that go in the tabs. 
  add(new Link<String>("AquaponicsPageLink") { 
    private static final long serialVersionUID = 1L;
    /** Upon clicking this link, go to HomePage. */
    @Override
    public void onClick() { 
      setResponsePage(new AquaponicsPage());
    } 
    } 
  );
  
  add(new Link<String>("LightingPageLink") {
    private static final long serialVersionUID = 1L;
    /** Upon clicking this link, go to ListPage. */
    @Override
    public void onClick() {
      setResponsePage(new LightingPage());
    } 
    }
  );
  
  add(new Link<String>("SecurityPageLink") {
    private static final long serialVersionUID = 1L;
    /** Upon clicking this link, go to FormPage. */
    @Override
    public void onClick() {
      setResponsePage(new SecurityPage());
    }
    }
  );
  
  add(new Link<String>("ClimatePageLink") { 
    private static final long serialVersionUID = 1L;
    /** Upon clicking this link, go to TablePage. */
    @Override
    public void onClick() { 
      setResponsePage(new ACPage()); 
    } 
    } 
  ); 
  
  add(new Link<String>("WaterPageLink") {  
    private static final long serialVersionUID = 1L;
    /** Upon clicking this link, go to TablePage. */
    @Override
    public void onClick() { 
      setResponsePage(new WaterPage());
    } 
    } 
  ); 
  
  add(new Image("sidebar", new Model<ResourceReference>(SIDE_BAR)));
  add(new Image("logo", new Model<ResourceReference>(LOGO)));
}
}


